package com.xueqiu.lovepetmedicalmanagersystem.service.Impl;

import com.xueqiu.lovepetmedicalmanagersystem.mapper.VisitsMapper;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.Visits;
import com.xueqiu.lovepetmedicalmanagersystem.service.VisitsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xueqiu
 */
@Service
public class VisitsServiceImpl implements VisitsService {

    @Autowired
    private VisitsMapper visitsMapper;

    /**
     * 根据宠物ID查询病例
     * @param petId 宠物ID
     * @return 病例对象；可能找不到为NULL
     */
    @Override
    public List<Visits> getVisitByPetId(Integer petId) {
        return visitsMapper.getVisitByPetId(petId);
    }

    /**
     * 新增单个病例数据
     * @param visits 数据源，不包含病例ID
     * @return 新增条数
     */
    @Override
    public Integer addVisit(Visits visits) {
        return visitsMapper.insertVisit(visits);
    }
}
